package com.buydeem.singleton;

/**
 * 饿汉式单例
 *
 * @author zengchao
 * @date 2022-04-26 14:19:19
 */
public class Singleton {
    private static Singleton instance = new Singleton();

    private Singleton(){

    }

    public static Singleton getInstance(){
        return instance;
    }

    public static void main(String[] args) {
        Singleton singleton1 = Singleton.getInstance();
        Singleton singleton2 = Singleton.getInstance();
        System.out.println(singleton1 == singleton2);
    }
}
